import 'package:flutter/material.dart';
import 'package:hospitable_rental/pages/home/advisory/advisory_item.dart';
import 'package:hospitable_rental/pages/home/advisory/advisory_item_widget.dart';

class AdvisoryWidget extends StatelessWidget {
  final List<AdvisoryItem> dataList;
  final bool showTitle;

  const AdvisoryWidget({
    Key? key,
    this.dataList = advisoryItemList,
    this.showTitle = true,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: [
          if (showTitle)
            Container(
              alignment: Alignment.centerLeft,
              padding: EdgeInsets.all(10.0),
              child: Text(
                "最新资讯",
                style: TextStyle(color: Colors.black, fontWeight: FontWeight.w600),
              ),
            ),
          Column(
            children: dataList
                .map(
                  (item) => AdvisoryItemWidget(item),
                )
                .toList(),
          )
        ],
      ),
    );
  }
}
